import { axios } from '../../utils/request'

const api = {
    save: '/finance/accountingVoucher/save',
    examine: '/finance/accountingVoucher/examine',
    delete: '/finance/accountingVoucher/delete',
    list: '/finance/accountingVoucher/pageList',
    page: '/finance/accountingVoucher/getOneByCondition',
    getcode: '/finance/accountingVoucher/getCode',//编码
    book: '/finance/accountingVoucher/book',//记账
    unbook: '/finance/accountingVoucher/unBook',//记账
    beginMoney: '/finance/accountingAuxiliaryLedger/getAccountingBegin',//获取科目期初余额
    getAuxiList: '/finance/accountingAuxiliaryLedger/pageAuxiliaryBeginList',//获取辅助期初余额列表
    saveAuxi: '/finance/accountingAuxiliaryLedger/save',//保存辅助科目期初

}
/**
 * 保存
 */
export function save (data) {
    return axios({
        url: api.save,
        method: "post",
        data: data
    })
}

/**
 * 审核
 */
export function examine (data) {
    return axios({
        url: api.examine,
        method: "post",
        data: data
    })
}
/**
 * 记账
 */
export function book (data) {
    return axios({
        url: api.book,
        method: "post",
        data: data
    })
}
/**
 *取消记账 
 * @param {*} data 
 * @returns 
 */
export function unBook (data) {
    return axios({
        url: api.unbook,
        method: "post",
        data: data
    })
}
/**
 * 整理
 */
export function collate (data) {
    return axios({
        url: '/finance/accountingVoucher/collateAccounting',
        method: "get",
        params: data
    })
}

/**
 * 通过ID获取某个会计凭证的数据
 */
export function getPage (data) {
    return axios({
        url: api.page,
        method: "get",
        params: data
    })
}
/**
 * 获取编码
 */
export function getCode (data) {
    return axios({
        url: api.getcode,
        method: "get",
        params: data
    })
}

/**
 * 删除
 */
export function remove (data) {
    return axios({
        url: api.delete,
        method: "delete",
        params: data
    })
}

/**
 * 列表
 */
export function getList (data) {
    return axios({
        url: api.list,
        method: "get",
        params: data
    })
}

/**
 * 获取科目期初余额
 */
export function getAccountingBegin (data) {
    return axios({
        url: api.beginMoney,
        method: "get",
        params: data
    })
}
/**
 * 保存辅助期初余额
 */
export function saveAuxiliaryLedger (data) {
    return axios({
        url: api.saveAuxi,
        method: "post",
        data: data
    })
}
/**
 * 获取辅助科目期初列表
 */
export function getAuxiList (data) {
    return axios({
        url: api.getAuxiList,
        method: "get",
        params: data
    })
}

